CREATE TABLE [dbo].[NC_DETALLES]
(
[ID] [numeric] (10, 0) NOT NULL,
[ID_PRODUCTO] [numeric] (10, 0) NOT NULL,
[PRECIO] [numeric] (10, 2) NOT NULL CONSTRAINT [DF_NC_DETALLES_PRECIO] DEFAULT ((0)),
[COSTO] [numeric] (10, 2) NOT NULL CONSTRAINT [DF_NC_DETALLES_COSTO] DEFAULT ((0)),
[CANTIDAD] [numeric] (10, 2) NOT NULL CONSTRAINT [DF_NC_DETALLES_CANTIDAD] DEFAULT ((0)),
[DESCUENTO] [numeric] (10, 2) NULL CONSTRAINT [DF_NC_DETALLES_DESCUENTO] DEFAULT ((0)),
[X_DESCUENTO] [numeric] (10, 4) NULL CONSTRAINT [DF_NC_DETALLES_X_DESCUENTO] DEFAULT ((0)),
[IMPUESTO] [numeric] (10, 2) NULL CONSTRAINT [DF_NC_DETALLES_IMPUESTO] DEFAULT ((0)),
[X_IMPUESTO] [numeric] (10, 4) NULL CONSTRAINT [DF_NC_DETALLES_X_IMPUESTO] DEFAULT ((0))
) ON [PRIMARY]
GO
ALTER TABLE [dbo].[NC_DETALLES] ADD CONSTRAINT [PK_NC_DETALLES] PRIMARY KEY CLUSTERED  ([ID], [ID_PRODUCTO]) ON [PRIMARY]
GO
ALTER TABLE [dbo].[NC_DETALLES] ADD CONSTRAINT [FK_NC_DETALLES_NC] FOREIGN KEY ([ID]) REFERENCES [dbo].[NC] ([ID]) ON DELETE CASCADE
GO
ALTER TABLE [dbo].[NC_DETALLES] ADD CONSTRAINT [FK_NC_DETALLES_PRODUCTOS] FOREIGN KEY ([ID_PRODUCTO]) REFERENCES [dbo].[PRODUCTOS] ([ID]) ON DELETE CASCADE
GO
